import Mock from 'mockjs2'
import { builder } from '../util'

const pageData = () => {
    return builder({
        total: 99,
        current: 6,
        size: 20,
        records: [{
            'id': 1,
            'name': '深度复盘！裂变23级、裂变率97%，苏宁、顺丰日涨万粉背后的操盘秘诀',
            'createdTime': 1603271444032,
            'e': 'https://xiaoliebian-sys.oss-cn-hangzhou.aliyuncs.com/img/operation/poster/066b58c1a8f84e3b80cfc303a67114d3.jpg',
            'desc': '双11还在专注用户增长的运营人，一晚涨粉过万！ 点击查看他们的涨粉秘诀吧 ↑↑↑',
            'enable': 1
        }, {
            'id': 1003,
            'name': '深度复盘！裂变23级、裂变率97%，苏宁、顺丰日涨万粉背后的操盘秘诀',
            'createdTime': 1603271444032,
            'poster': 'https://xiaoliebian-sys.oss-cn-hangzhou.aliyuncs.com/img/operation/poster/066b58c1a8f84e3b80cfc303a67114d3.jpg',
            'desc': '双11还在专注用户增长的运营人，一晚涨粉过万！ 点击查看他们的涨粉秘诀吧 ↑↑↑',
            'enable': 0
        }, {
            'id': 1004,
            'name': '深度复盘！裂变23级、裂变率97%，苏宁、顺丰日涨万粉背后的操盘秘诀',
            'createdTime': 1603271444032,
            'poster': 'https://xiaoliebian-sys.oss-cn-hangzhou.aliyuncs.com/img/operation/poster/066b58c1a8f84e3b80cfc303a67114d3.jpg',
            'desc': '双11还在专注用户增长的运营人，一晚涨粉过万！ 点击查看他们的涨粉秘诀吧 ↑↑↑',
            'enable': 0
        }, {
            'id': 1005,
            'name': '深度复盘！裂变23级、裂变率97%，苏宁、顺丰日涨万粉背后的操盘秘诀',
            'createdTime': 1603271444032,
            'poster': 'https://xiaoliebian-sys.oss-cn-hangzhou.aliyuncs.com/img/operation/poster/066b58c1a8f84e3b80cfc303a67114d3.jpg',
            'desc': '双11还在专注用户增长的运营人，一晚涨粉过万！ 点击查看他们的涨粉秘诀吧 ↑↑↑',
            'enable': 1
        }
        ]
    })
}

const getSop = () => {
    return builder({
        'qwUserId': 3,
        'name': '规则名称',
        'targetList':
            [{
                'groupChantId': 1,
                'userId': '1'
            },
                {
                    'groupChantId': 2,
                    'userId': '12'
                }],
        'ruleList':
            [{
                'pushTime': 1603271444032,
                'messageList':
                    [{
                        'type': 'TEXT',
                        // eslint-disable-next-line no-useless-escape
                        'content': '{\"title\":\"aaaa\",\"desc\":\"dddd\",\"url\":\"uuuu\",\"img\":\"iiii\"}'

                    }]
            }]
    })
}

const changeStatus = () => {
    return builder('操作成功')
}
Mock.mock(/\/qw\/sop\/getSop/, 'get', getSop)
Mock.mock(/\/qw\/sop\/page/, 'get', pageData)
Mock.mock(/\/qw\/sop\/del/, 'get', changeStatus)
Mock.mock(/\/qw\/sop\/enable/, 'get', changeStatus)
Mock.mock(/\/qw\/sop\/save/, 'post', changeStatus)
